package com.hdaccp.letting.controller;

import com.hdaccp.letting.bean.entity.Users;
import com.hdaccp.letting.util.UsersUtil;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @RequestMapping("/getUsers/{id}")
    public Users getUsers(@PathVariable("id") int id){
        Users u = null ;
        List<Users> list = UsersUtil.getUsers() ;
        for(Users users : list){
            if(users.getId() == id){
                u = users ;
                break ;
            }
        }
        return u ;
    }
    @RequestMapping("/show")
    public String show(){
        System.out.println("hello users!");
        return "hello users!!" ;
    }

}
